import req from './base/req'

export type IQueueUser = {
  uid: string
  id: number
  account: string
  box: string
  sort: number
  name: string
  remark: string
  state: 0 | 1 | 9
}

export const getQueueList = (params?: {
  page: number
  size: number
}): IResList<IQueueUser> => req.get('/queue', { params })

export const getQueueDetail = (id: number): Promise<IQueueUser> =>
  req.get('/queue/' + id)

export const addQueue = (data: IQueueUser): IResAdd => req.post('/queue', data)

export const changeQueue = (data: Partial<IQueueUser>) =>
  req.put('/queue', data)

export const clearQueue = () => req.put('/queue/clear')

export const sortQueue = (data: { id: number; sort: number }[]) =>
  req.post('/queue/sort', data)
